package com.system.consultationroom.bean;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.*;
import lombok.Data;

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * @className: consultationRoom
 * @description: 诊室实体类
 * @author: Li Chuanwei
 * @date: 2023/11/30 15:40
 * @Company: Copyright [日期] by [作者或个人]
 **/
@Data
@Entity
@JsonIgnoreProperties({"hibernateLazyInitializer","handler","fieldHandler"})
public class ConsultationRoom {
    /**
     * 自增长ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer consultationRoomId;

    /**
     * 名字
     */
    private String crName;

    /**
     * 所属科室ID
     */
    private Integer departID;

    /**
     * 备注
     */
    private String memo;

    /**
     * 状态:0不可用,1可用
     */
    @Column(columnDefinition = "integer default 1")
    private Integer state = 1;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    private LocalDateTime updateTime;

    @PrePersist
    protected void onCreate() {
        createTime = LocalDateTime.now();
        updateTime = LocalDateTime.now();
    }

    @PreUpdate
    protected void onUpdate() {
        updateTime = LocalDateTime.now();
    }
}

